<script Language="JavaScript">
<!-- 
function Validator(myForm)
{       
// Check the value of the element named text_name from the form named text_form
if (myForm.Login.value.trim() == "" || myForm.password.value.trim() == "")
{               
  // If null display and alert box
   alert("You are missing data!");
  // Place the cursor on the field for revision
   newaccount.Login.focus();
  // return false to stop further processing
   return (false);
}
// If text_name is not null continue processing
return (true);
}
-->
</script>

<?php
	include('db.php');
echo '<form action="createOrder.php" method="post" enctype="multipart/form-data" name="orderForm" target="_parent onsubmit="return Validator(this)"">';
$q=$_GET["q"];
        $TABLE1 = "Parts";
        $TABLE2 = "Parts_Required";
        $TABLE3 = "Finished_Goods";
        $ROW_NUMBER = 0;
        $CON = mysql_connect( $HOST, $USER, $PASS );
        
        if (!$CON)
          {
                  die('Could not connect: ' . mysql_error());
          }

        mysql_select_db( $DB );
        $QRY = "SELECT Parts.part_id, Finished_Goods.fg_id, Parts.cost, Parts.part_description FROM Parts, Parts_Required, Finished_Goods WHERE Parts.part_id = Parts_Required.part_id AND Parts_Required.fg_id = Finished_Goods.fg_id AND Finished_Goods.fg_id ='".$q."'";

        $result = mysql_query($QRY) or die($QRY."<br/><br/>".mysql_error());


        echo "<p><center>";
        echo "<select name = 'finishgood_list[]' multiple>";
        while ($row = mysql_fetch_array($result))
            {
                echo "<option value='" . $row['part_id'] . "'>" . $row['part_id'] . "</option>";
            }
        echo "</select></center></p>";
        echo "<p><center>Quantity to order: ";
        echo "<input type='text' name='quant'> <input type='submit' value='Submit' /></p></center>";
        mysql_close($CON);
        echo '</form>';
?>




